package com.itheima.behaviour.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.behaviour.mapper.ApUnlikesBehaviorMapper;
import com.itheima.behaviour.pojo.ApUnlikesBehavior;
import com.itheima.behaviour.service.ApUnlikesBehaviorService;
import org.springframework.stereotype.Service;

/**
 * @description <p>APP不喜欢行为 业务实现</p>
 *
 * @version 1.0
 * @package com.itheima.behaviour.service.impl
 */
@Service
public class ApUnlikesBehaviorServiceImpl extends ServiceImpl<ApUnlikesBehaviorMapper, ApUnlikesBehavior> implements ApUnlikesBehaviorService {

    /**
     * 通过文章Id与行为实体Id 查询是否不喜欢
     *
     * @param articleId
     * @param entryId
     * @return
     */
    @Override
    public ApUnlikesBehavior findByArticleIdAndEntryId(Long articleId, Integer entryId) {
        LambdaQueryWrapper<ApUnlikesBehavior> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ApUnlikesBehavior::getArticleId, articleId)
                .eq(ApUnlikesBehavior::getEntryId,entryId);
        return getOne(lqw);
    }
}
